﻿//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Web;
//using System.Web.UI;
//using System.Web.UI.WebControls;
//using System.Data;
//using Touch2Like.DAL;

//namespace Touch2Like.Web.Customer
//{
//    public partial class Orders : System.Web.UI.Page
//    {
//        Touch2Like.DAL.Order order = new Touch2Like.DAL.Order();
//        protected void Page_Load(object sender, EventArgs e)
//        {
//            if (WebUtility.UserGUID == "0")
//            {
//                Response.Redirect("/Customer/signin.aspx");
//            }

//            this.Master.CurrentPage = "NFCTagManager";


//            if (!IsPostBack)
//            {
//                GridView_Order.DataSource = order.GetByUserID(WebUtility.UserGUID);
//                GridView_Order.DataBind();
//            }
//        }

//        protected void GridView_Order_PageIndexChanging(object sender, GridViewPageEventArgs e)
//        {
//            GridView_Order.PageIndex = e.NewPageIndex;
//            DataTable dt = order.GetByUserID(WebUtility.UserGUID);
//            GridView_Order.DataBind();
//        }

//        protected void GridView_Order_Sorting(object sender, GridViewSortEventArgs e)
//        {
//            if (Session["SortDirection"] == null) Session["SortDirection"] = "ASC";
//            if (Session["SortBy"] == null) Session["SortBy"] = "ListID";
//            if (e.SortExpression == Session["SortBy"].ToString()) Session["SortDirection"] = Session["SortDirection"] == "ASC" ? "DESC" : "ASC";
//            else Session["SortDirection"] = "ASC";

//            DataTable dt = order.GetByUserID(WebUtility.UserGUID);
//            DataView dv = new DataView(dt);
//            Session["SortBy"] = e.SortExpression;
//            dv.Sort = GetSortBy();
//            GridView_Order.DataSource = dv;
//            GridView_Order.DataBind();
//        }

//        public string GetLongDateString(object d)
//        {
//            DateTime dt = Convert.ToDateTime(d);
//            string[] months = new string[] { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" };
//            string month = months[dt.Month - 1];
//            string day = dt.Day.ToString();
//            string year = dt.Year.ToString();

//            return month + " " + day + ", " + year;
//        }

//        string GetSortBy()
//        {
//            string sortby = "";

//            sortby = " ListID";

//            if (Session["SortBy"] != null)
//            {
//                if (!string.IsNullOrEmpty(Session["SortBy"].ToString()))
//                {
//                    sortby = " " + Session["SortBy"].ToString();
//                }
//            }
//            else Session["SortBy"] = sortby;

//            if (Session["SortDirection"] != null)
//            {
//                if (!string.IsNullOrEmpty(Session["SortDirection"].ToString()))
//                {
//                    return sortby + " " + Session["SortDirection"].ToString();
//                }
//            }

//            return sortby + " " + "ASC";
//        }

//        protected void GridView_Order_RowDataBound(object sender, GridViewRowEventArgs e)
//        {
//            ShoppingCart cart = new ShoppingCart();
//            GridViewRow row = e.Row;

//            if (row != null && row.RowType == DataControlRowType.DataRow)
//            {
//                DataRowView view = row.DataItem as DataRowView;
//                Repeater Repeater_Cart = row.FindControl("Repeater_Cart") as Repeater;
//                Repeater_Cart.DataSource = cart.GetByOrderNumber(view["OrderNumber"].ToString());
//                Repeater_Cart.DataBind();
//            }
//        }
//    }
//}